import { ResPage, Goods } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import qs from "qs";

/**
 * @name 菜品管理模块
 */

// 获取菜品分类列表
export const getFoodCategoryList = (params?: {}) => {
  return http.post<ResPage<Goods.ResGoodsCategoryList>>(PORT1 + `/CoreCmsFoodCategory/GetPageList`, qs.stringify(params));
};

// 获取菜品列表
// export const getGoodsList = (params: { ctegoryId?: any; pageNum?: number; pageSize?: number }) => {
//   return http.post<ResPage<Goods.ResGoodsList>>(PORT1 + `/corecmsfood/GetPageList`, qs.stringify(params));
// };
// 菜品列表 多规格
export const getGoodsList = (params: {}) => {
  return http.post<ResPage<Goods.ResGoodsList>>(PORT1 + `/CoreCmsFood/GetFoodSpecPageList`, qs.stringify(params));
};

// 菜品列表单品查询
export const getGoodsSingleItem = (params: {}) => {
  return http.post<ResPage<Goods.ResGoodsList>>(PORT1 + `/CoreCmsFood/GetFoodSpecPageList`, qs.stringify({ ...params, type: 1 }));
};

// 菜品列表 单规格
export const getFoodList = (params: {}) => {
  return http.post<ResPage<Goods.ResGoodsList>>(PORT1 + `/CoreCmsFood/GetPageList`, qs.stringify(params));
};

// 新增菜品
export const createFood = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFood/DoCreate`, params);
};

// 获取菜品资料
export const getFoodDedail = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFood/GetEdit`, params);
};

// 编辑菜品资料
export const editFood = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFood/DoEdit`, params);
};

// 删除菜品资料
export const deleteFood = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFood/DoDelete`, params);
};

// 获取菜品规格列表
export const getFoodsPecInfoList = (params: Goods.ResGoodsSpecificationsList) => {
  return http.get<ResPage<Goods.ResGoodsSpecificationsList>>(PORT1 + `/CoreCmsFoodCategory/GetPageList`, params);
};

// 获取菜品父级分类列表
export const getParentFoodcategoryList = (params?: Goods.ParentFoodcategoryList) => {
  return http.post<ResPage<Goods.ParentFoodcategoryList>>(PORT1 + `/CoreCmsFoodCategory/GetParentList`, qs.stringify(params));
};

// 获取菜品做法分组列表
export const getFoodtaskCategory = (params?: Goods.ParentFoodcategoryList) => {
  return http.post<ResPage<Goods.ParentFoodtaskCategory>>(PORT1 + `/CoreCmsFoodTaskCategory/GetPageList`, qs.stringify(params));
};

// 创建菜品做法分组
export const addFoodtaskCategory = (params: { name: string }) => {
  return http.post(PORT1 + `/CoreCmsFoodTaskCategory/DoCreate`, params);
};

// 编辑做法分组
export const editFoodtaskcategory = (params: Goods.ParentFoodtaskCategory) => {
  return http.post(PORT1 + `/CoreCmsFoodTaskCategory/DoEdit`, params);
};

// 删除做法分组
export const deleteFoodtaskcategory = (params: { id?: number }) => {
  return http.post(PORT1 + `/CoreCmsFoodTaskCategory/DoDelete`, params);
};

// 获取菜品做法列表
export const getFoodtaskList = (params?: Goods.ParentFoodtaskList) => {
  return http.post<ResPage<Goods.ParentFoodtaskList>>(PORT1 + `/CoreCmsFoodtask/GetPageList`, qs.stringify(params));
};

// 新增菜品做法
export const createFoodtask = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodtask/DoCreate`, params);
};

// 编辑菜品做法
export const editFoodtask = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodtask/DoEdit`, params);
};

// 删除菜品做法
export const deleteFoodtask = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodtask/DoDelete`, params);
};

// 编辑菜品分类
export const editFoodCategory = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsFoodCategory/DoEdit`, params);
};

// 创建菜品分类
export const addFoodCategory = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsFoodCategory/DoCreate`, params);
};

// 删除菜品分类
export const deleteFoodCategory = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsFoodCategory/DoDelete`, params);
};

// 获取菜品加料列表
export const getFoodFeedList = (params?: Goods.ParentFoodFeedList) => {
  return http.post<ResPage<Goods.ParentFoodFeedList>>(PORT1 + `/CoreCmsFoodFeed/GetPageList`, qs.stringify(params));
};

// 新增加料
export const createFoodfeed = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodFeed/DoCreate`, params);
};

// 编辑加料
export const editFoodfeed = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodFeed/DoEdit`, params);
};

// 删除加料
export const deleteFoodfeed = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodFeed/DoDelete`, params);
};

// 获取菜品加料分组列表
export const getFoodFeedCategory = (params?: Goods.ParentFoodFeedList) => {
  return http.post<ResPage<Goods.ParentFoodFeedCategory>>(PORT1 + `/CoreCmsFoodFeedCategory/GetPageList`, qs.stringify(params));
};

// 新增加料分组
export const createFoodFeedCategory = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodFeedCategory/DoCreate`, params);
};

// 编辑加料分组
export const editFoodFeedCategory = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodFeedCategory/DoEdit`, params);
};

// 删除加料分组
export const deleteFoodFeedCategory = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodFeedCategory/DoDelete`, params);
};

// // 编辑会员等级
// export const editMemberGrade = (params: { id: string }) => {
//   return http.post(PORT1 + `/CoreCmsUserGrade/DoEdit`, params);
// };

// // 删除会员等级
// export const deleteMemberGrade = (params: { id: string }) => {
//   return http.post(PORT1 + `/CoreCmsUserGrade/DoDelete`, params);
// };

// // 新增会员等级
// export const addMemberGrade = (params: { id: string }) => {
//   return http.post(PORT1 + `/CoreCmsUserGrade/DoCreate`, params);
// };

// 获取 订单备注/原因 类型列表 传type
export const getFoodTagLst = (params?: {}) => {
  return http.post<ResPage<Goods.ResFoodTagLst>>(PORT1 + `/CoreCmsFoodTag/GetPageList`, qs.stringify(params));
};

// 新增 订单备注/原因 类型
export const createFoodTagLst = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodTag/DoCreate`, params);
};

// 编辑 订单备注/原因 类型
export const editFoodTagLst = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodTag/DoEdit`, params);
};

// 删除 订单备注/原因 类型
export const deleteFoodTagLst = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodTag/DoDelete`, params);
};

// 获取原料配比列表
export const getFoodSet = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodSet/GetFoodSetDetail`, params);
};

// 设置原料配比
export const editFoodSet = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsFoodSet/DoEdit`, params);
};

// 获取菜品分组列表
export const getGoodsGroupListAPI = (params: {}) => {
  return http.post<ResPage<Goods.GroupList>>(PORT1 + "/corecmsfoodgroup/GetPageList", qs.stringify(params));
};
// 新增菜品分组
export const addGoodsGroupAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmsfoodgroup/doCreate", params);
};
// 编辑菜品分组
export const editGoodsGroupAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmsfoodgroup/doEdit", params);
};
// 编辑菜品分组
export const deleteGoodsGroupAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmsfoodgroup/doDelete", params);
};
